﻿/*--------------------------------------------------------------------------------
 * Adaptive Intelligence - Foundation Framework Class Library
 * Version 2.00
 * 
 * ZIP Created By Version Class
 * 		Represents and manages the version data that indicates the compatibility 
 * of the file attribute information and the version of the application that created
 * the file.
 *------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------
 * System Imports
 *------------------------------------------------------------------------------*/
using System;

namespace Adaptive.Foundation.IO.Zip
{
    /// <summary>
    /// Represents and manages the version data that indicates the compatibility
    /// of the file attribute information and the version of the application that created
    /// the file.
    /// </summary>
    public sealed class ZipCreatedByVersion : ZipVersionBase
    {
        /*--------------------------------------------------------------------------------
         * Constructor / Dispose / Destructor Methods
         *------------------------------------------------------------------------------*/
        #region Constructor / Dispose / Destructor Methods
        /// <summary>
        /// Initializes a new instance of the <see cref="ZipCreatedByVersion" /> class.
        /// </summary>
        public ZipCreatedByVersion()
            : base()
        {
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ZipCreatedByVersion" /> class.
        /// </summary>
        /// <param name="originType">Type of the origin.</param>
        /// <param name="versionNumber">The version number.</param>
        public ZipCreatedByVersion(byte originType, byte versionNumber)
            : base(originType, versionNumber)
        {
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ZipCreatedByVersion" /> class.
        /// </summary>
        /// <param name="originType">Type of the origin.</param>
        /// <param name="versionNumber">The version number.</param>
        public ZipCreatedByVersion(ZipOriginationType originType, byte versionNumber)
            : base((byte)originType, versionNumber)
        {
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ZipCreatedByVersion" /> class.
        /// </summary>
        /// <param name="value">The value.</param>
        public ZipCreatedByVersion(short value)
            : base(value)
        {
        }
        #endregion

        /*--------------------------------------------------------------------------------
         * Public Properties
         *------------------------------------------------------------------------------*/
        #region Public Properties
        /// <summary>
        /// Gets or sets the type of the file system on which the file was created.
        /// </summary>
        /// <value>
        /// A <see cref="ZipOriginationType"/> enumerated value that indicates the file 
        /// system on which the Zip file was created.
        /// </value>
        public ZipOriginationType OriginationType
        {
            get
            {
                return (ZipOriginationType)HighByte;
            }
            set
            {
                HighByte = (byte)value;
            }
        }
        /// <summary>
        /// Gets or sets the version number byte value.
        /// </summary>
        /// <value>The version number byte value.</value>
        public byte VersionNumber
        {
            get
            {
                return LowByte;
            }
            set
            {
                LowByte = value;
            }
        }
        /// <summary>
        /// Gets the major version number.
        /// </summary>
        /// <value>The major version number.</value>
        public int MajorVersion
        {
            get
            {
                return Convert.ToInt32(((float)LowByte) / 10);
            }
        }
        /// <summary>
        /// Gets the minor version number.
        /// </summary>
        /// <value>The minor version number.</value>
        public int MinorVersion
        {
            get
            {
                return Convert.ToInt32(((float)LowByte) % 10);
            }
        }
        #endregion
    }
}
